package com.cg.design.graphicdesignpattern.observer;

/**
 * 表示以****这样的简单图形显示观察到的数值
 *
 * @program: LeetCode->GraphObserver
 * @description: 表示以****这样的简单图形显示观察到的数值
 * @author: cg
 * @create: 2022-03-29 21:38
 **/
public class GraphObserver implements Observer {
    @Override
    public void update(NumberGenerator generator) {
        System.out.print("GraphObserver:");
        int count = generator.getNumber();
        for (int i = 0; i < count; i++) {
            System.out.print("*");
        }
        System.out.println("");
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
